//
//  HMBaseTableViewController.swift
//  sinaweibo
//
//  Created by lst on 16/5/21.
//  Copyright © 2016年 lst. All rights reserved.
//

import UIKit

class HMBaseTableViewController: UITableViewController,HMVisttorLoginViewDelegate {
    
    //根据用户是否登录显示 登录页面还是访客视图页面
    var userLogin = HMUserAccountViewModel.sharedAccountViewModel.userLogin
    //添加访客视图的属性
   lazy var visitorLoginView: HMVisttorLoginView = HMVisttorLoginView()
    
    //重写loadView
    override func loadView() {
        if userLogin {
            //显示tableVIew
            super.loadView()
        } else {
            //显示访客视图
            self.loadVisitorView()
        }
    }
    

    private func loadVisitorView(){
        view = visitorLoginView
        visitorLoginView.vistorDelegate = self
    }
    
    func userWillLogin() {
        print("登陆")
        let oauth = HMOAuthViewController()
        //嵌入导航控制器
        let nav = UINavigationController(rootViewController: oauth)
        //modal 出oauth控制器
        presentViewController(nav, animated: true, completion: nil)
    }
    func userWillRegister() {
        print("注册")
    }
    
    
    
    
    
    
    
    
    
    
    override func viewDidLoad() {
        super.viewDidLoad()

           }



   }
